﻿<UserControl x:Class="GrooveSharp.Rating"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             IsEnabledChanged="UserControl_IsEnabledChanged"
             mc:Ignorable="d" 
             d:DesignHeight="50" d:DesignWidth="100">

    <UserControl.Resources>
        <Style x:Key="StarToggleButtonStyle" TargetType="{x:Type ToggleButton}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToggleButton}">
                        <Canvas Width="12" Height="12">
                            <Path Name="star" Fill="Gray" 
        Data="M 5,0 L 4,4 L 0,4 L 3,7 L 2,11 L 5,9 L 6,9 L 9,11 L 8,7 L 11,4 L 7,4 L 6,0"/>
                        </Canvas>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter TargetName="star" Property="Fill" Value="Gold"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
        <CheckBox Content="1" Style="{StaticResource StarToggleButtonStyle}" Name="star1" Tag="0" Margin="1" Click="star_Checked" />
        <CheckBox Content="2" Style="{StaticResource StarToggleButtonStyle}" Name="star2" Tag="1" Margin="1" Click="star_Checked" />
        <CheckBox Content="3" Style="{StaticResource StarToggleButtonStyle}" Name="star3" Tag="2" Margin="1" Click="star_Checked" />
        <CheckBox Content="4" Style="{StaticResource StarToggleButtonStyle}" Name="star4" Tag="3" Margin="1" Click="star_Checked" />
        <CheckBox Content="5" Style="{StaticResource StarToggleButtonStyle}" Name="star5" Tag="4" Margin="1" Click="star_Checked" />
    </StackPanel>
</UserControl>
